package com.ruoyi.cms.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * 页面导航对象 cms_navigation
 * 
 * @author ruoyi
 * @date 2024-02-01
 */
public class CmsNavigation extends BaseEntity
{
    public static final String TYPE_LINK = "link";
    public static final String TYPE_CATALOG = "catalog";
    public static final String TYPE_FORM = "form";

    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 导航名称 */
    @Excel(name = "导航名称")
    private String title;

    /** 导航类别 */
    @Excel(name = "导航类别")
    private String type;

    /** 图标 */
    @Excel(name = "图标")
    private String icon;

    /** 栏目内容 */
    @Excel(name = "栏目内容")
    private String uri;

    /** 导航位置 */
    @Excel(name = "导航位置")
    private String position;

    /** 打开方式 */
    @Excel(name = "打开方式")
    private String target;

    /** 排序 */
    @Excel(name = "排序")
    private Integer sorts;

    public List<CmsNavigation> children;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setTitle(String title) 
    {
        this.title = title;
    }

    public String getTitle() 
    {
        return title;
    }
    public void setType(String type) 
    {
        this.type = type;
    }

    public String getType() 
    {
        return type;
    }
    public void setIcon(String icon) 
    {
        this.icon = icon;
    }

    public String getIcon() 
    {
        return icon;
    }
    public void setUri(String uri) 
    {
        this.uri = uri;
    }

    public String getUri() 
    {
        return uri;
    }
    public void setPosition(String position) 
    {
        this.position = position;
    }

    public String getPosition() 
    {
        return position;
    }
    public void setTarget(String target) 
    {
        this.target = target;
    }

    public String getTarget() 
    {
        return target;
    }
    public void setSorts(Integer sorts)
    {
        this.sorts = sorts;
    }

    public Integer getSorts()
    {
        return sorts;
    }

    public void addChildren(CmsNavigation subNav) {
        if(children == null){
            children = new ArrayList<>();
        }
        children.add(subNav);
    }
    public List<CmsNavigation> getChildren() {
        return children;
    }

    public void setChildren(List<CmsNavigation> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("title", getTitle())
            .append("type", getType())
            .append("icon", getIcon())
            .append("uri", getUri())
            .append("position", getPosition())
            .append("target", getTarget())
            .append("sorts", getSorts())
            .toString();
    }
}
